package com.huahua.api.repository;

import com.huahua.api.entity.pojo.CloudPrintPrinter;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/**
 * @author Huahua-Ai
 * @date 2025-07-24 17:50:00
 * @description 云打印打印机Repository
 */
@Repository
public interface CloudPrintPrinterRepository extends ReactiveCrudRepository<CloudPrintPrinter, Long> {

    /**
     * 根据设备ID查找所有打印机
     */
    Flux<CloudPrintPrinter> findByDeviceIdAndIsActive(String deviceId, Boolean isActive);

    /**
     * 根据设备ID和打印机名称查找
     */
    Mono<CloudPrintPrinter> findByDeviceIdAndPrinterName(String deviceId, String printerName);

    /**
     * 查找设备的默认打印机
     */
    Mono<CloudPrintPrinter> findByDeviceIdAndIsDefaultTrue(String deviceId);

    /**
     * 删除设备的所有打印机
     */
    Mono<Void> deleteByDeviceId(String deviceId);
}
